package www.wen.com.common.lib.extension

import android.animation.ObjectAnimator
import android.animation.ValueAnimator
import android.view.View
import www.wen.com.common.lib.view.expandable.Utils

fun createRotateAnimator(
    target: View?,
    from: Float,
    to: Float,
    duration: Long = 300,
    restart: Boolean = false
): ObjectAnimator {
    val animator = ObjectAnimator.ofFloat(target, "rotation", from, to)
    animator.duration = duration
    if (restart) {
        animator.repeatMode = ValueAnimator.RESTART
    }
    animator.interpolator = Utils.createInterpolator(Utils.LINEAR_INTERPOLATOR)
    return animator
}